/* CS32 FINAL PROJECT */

package Objects;

import GameEngine.GameConstants.Effect;
import GameEngine.GameConstants.Modifier;
import GameEngine.Vector;

/**
 * This class is a simple pair that has an effect, the power of the effect, and the
 * number of iterations this effect will last for.
 * @author mhfowler
 */
public class PersistentEffect {

    Effect eff;
    Effect opp;
    Vector dir;
    int power;
    int timeRemaining;


    public PersistentEffect(Effect e, Effect o, Vector d, int p, int tRemaining) {
        eff = e;
        opp = o;
        dir = d;
        power = p;
        timeRemaining = tRemaining;
    }


    public void useEffect(GameObject o) {
        o.receiveEffect(eff, dir, power);
       
    }


    public boolean cancelEffect(GameObject o) {
        boolean expired = false;
        o.receiveEffect(opp, dir, power);
        timeRemaining--;
        if (timeRemaining <= 1) {
            expired = true;
        }
        return expired;
    }








}
